Platform Explorer / Nuxeo Platform 11.4

Component org.nuxeo.runtime.datasource

Documentation

Component use to register datasources.

Requirements

Resolution Order

736
The resolution order represents the order in which this component has been resolved by the Nuxeo Runtime framework.
You can influence this order by adding "require" tags in your component declaration, to make sure it is resolved after another component.

Start Order

1 (Declared Start Order: -1000)
The start order represents the order in which this component has been started by the Nuxeo Runtime framework.
This number is interesting to tweak if your Java component interacts with other components, and needs to be started before or after another one.
It can be changed by implementing the method "Component#getApplicationStartedOrder()" on your Java component: components are sorted according to this reference value, in increasing order.
The default value is 1000, and the repository initialization uses number 100. Negative values can also be used.

Implementation

Class: org.nuxeo.runtime.datasource.DataSourceComponent

Services

Extension Points

XML Source

<?xml version='1.0' encoding='UTF-8'?>
<component name="org.nuxeo.runtime.datasource">
  <documentation>
    Component use to register datasources.
  </documentation>

  <require>org.nuxeo.runtime.jtajca.JtaActivator</require>

  <service>
    <provide interface="org.nuxeo.runtime.datasource.PooledDataSourceRegistry"/>
  </service>

  <implementation class="org.nuxeo.runtime.datasource.DataSourceComponent"/>

  <extension-point name="datasources">
    <documentation>

      Example contribution:

      <code>
        <datasource name="jdbc/foo" driverClassName="org.h2.Driver" maxTotal="20" minTotal="5" maxWaitMillis="10000">
          <property name="url">jdbc:h2:/home/db;DB_CLOSE_ON_EXIT=false
          </property>
          <property name="username">nuxeo</property>
          <property name="password">********</property>
        </datasource>
      </code>

      Or, for a XA datasource:

      <code>
        <datasource name="jdbc/foo" xaDataSource="org.h2.jdbcx.JdbcDataSource" maxTotal="20" minTotal="5" maxWaitMillis="10000">
          <property name="databaseName">/home/db</property>
          <property name="createDatabase">create</property>
          <property name="user">nuxeo</property>
          <property name="password">********</property>
        </datasource>
      </code>

      The allowed attributes of a
      <b>datasource</b>
      element are:
      <ul>
        <li>
          <b>name</b>
          the JNDI name (for instance
          <tt>jdbc/foo</tt>
          )
        </li>
        <li>
          <b>driverClassName</b>
          the JDBC driver class name (only for a non-XA datasource)
        </li>
        <li>
          <b>xaDataSource</b>
          the XA datasource class name (only for a XA datasource)
        </li>
      </ul>
      <p/>
      To configure the characteristics of the pool:
      <ul>
        <li>
          <b>maxTotal</b>
          the maximum number of active connections
        </li>
        <li>
          <b>minTotal</b>
          the minimum number of idle connections
        </li>
        <li>
          <b>maxWaitMillis</b>
          the maximum number of milliseconds to wait for a connection to
          be
          available, or -1 (the default) to wait indefinitely
        </li>
        <li>
          ... see org.apache.commons.dbcp.BasicDataSource setters for
          more.
        </li>
      </ul>
      <p/>
      To configure the datasource, individual property sub-elements must
      be
      used.
      For a non-XA datasource,
      <b>url</b>
      ,
      <b>username</b>
      and
      <b>password</b>
      are commonly used. For a XA datasource, the properties are done
      according
      to the JavaBean setters of the datasource, see the
      documentation for
      your
      JDBC driver for more.
    </documentation>

    <object class="org.nuxeo.runtime.datasource.DataSourceDescriptor"/>
    <object class="org.nuxeo.runtime.datasource.DataSourceLinkDescriptor"/>
  </extension-point>

</component>